<%-- 
    Document   : categorylist
    Created on : Jul 20, 2012, 10:47:36 PM
    Author     : Atienza-Home
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
 
<style type="text/css">
    th{
        border: 2px solid black;
       
        
    }
    
    td{
        
        background-color: #009999;
        text-align: center;
       
    }
    
    
</style>

<link href="../adminpanel/header.css" rel="stylesheet" type="text/css"></link>
    
<%@page import="java.util.Iterator"%>
<%@page import="Factory.Tables.Category"%>
<%@page import="java.util.ArrayList"%>

<table width="990px"  >
<tr>
    <th width="8%">Pic</th>
    <th width="54%">Category</th>
    <th width="22%">Created</th>
    <th width="8%">Edit</th>
    <th width="8%">Delete</th>


</tr>


    
<% 
    ArrayList<Category> result = (ArrayList<Category>)session.getAttribute("categories");
    Iterator<Category> iter;
    Category category;
    int i;
    if(result!=null){
        iter = result.iterator(); 
        i=0;
        while(iter.hasNext()){
            category = iter.next();
            
            %>
            <tr>
                <%
                    try{
                    if(!category.getCategoryPic().isEmpty()){
                    %>
                        <td><img alt="noimage" src="../images/category/asd.png" style="width:250px;height:140px;"/></td>
                                         
                    <%                                                                                     
                    }}catch(Exception e){
                    %>
                        <td valign="middle"><img alt="noimage" src="../images/category/categorynopic.png" /></td>
                                         
                    <%      
                                       
                    }
                            
                %>
                <td valign="middle"><font><%=category.getCategoryName()%></font></td>
                <td valign="middle"><font></font></td>
                <td valign="middle"><div id="editcategory<%=category.getCategoryID() %>"><font><a href="javascript:gotoEditCategory(<%=category.getCategoryID()%>)">Edit</a></font></div></td>
                <td valign="middle"><div id="deletecategory<%=category.getCategoryID()%>"><font><a href="javascript:deleteCategory(<%=category.getCategoryID()%>)">Delete</a></font></div></td>
               
                
            
            
            
            
            
            
            </tr>
            
            <%
            
            i++;
        }
        
    }
%>
   
        

</table>
    
    
    
